Skip to content

distribution: fix epel repo metalinks#4108

Closed
l-austenfeld wants to merge 1 commit intosystemd:mainfrom
l-austenfeld:main
Closed

distribution: fix epel repo metalinks#4108
l-austenfeld wants to merge 1 commit intosystemd:mainfrom
l-austenfeld:main

Conversation

@l-austenfeld
Copy link

This commit fixes the EPEL repository meta-links.

There where two problems:

  • The link is different when a minor version is specified as well (i.e. 10.1 instead of just 10)
  • The names for the testing repos was wrong

The links can be confirmed by looking in the /etc/yum.repos.d/epel.repo and /etc/yum.repos.d/epel-testing.repo files on a system with the epel-release package installed.

The changes can be tested with this mkosi.conf:

[Distribution]
Distribution=rocky
Release=10.1
RepositoryKeyFetch=yes
Repositories=epel epel-testing

Comment on lines +311 to +314
if GenericVersion(context.config.release) >= 10:
repo_extra_part = "-z"
else:
repo_extra_part = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can shorten this a bit

Suggested change
if GenericVersion(context.config.release) >= 10:
repo_extra_part = "-z"
else:
repo_extra_part = ""
repo_extra_part = "-z" if GenericVersion(context.config.release) >= 10 else ""

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I forgot about ternary expressions. Will fix that.

else:
url = "metalink=https://mirrors.fedoraproject.org/metalink?arch=$basearch"

if GenericVersion(context.config.release) >= 10:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when 11 is released? It'll use the -z suffix as well then, which it probably shouldn't?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are some version parsing functions already in use in the code somewhere, I will see if I can just use those to check for the presence of a minor version.
I think this could already be a problem with just version 10 alone, but that never worked in my tests before (it tries to mix Rocky's 10.1 and EPEL's 10.2 repos and fails) so I can't really confirm.

Comment on lines 341 to 358
yield RpmRepository(
"epel-testing",
f"{url}&repo=testing-epel{release}",
f"{url}&repo=epel{repo_extra_part}-testing-{release}",
gpgurls,
enabled=False,
)
yield RpmRepository(
"epel-testing-debuginfo",
f"{url}&repo=testing-debug-epel{release}",
f"{url}&repo=epel{repo_extra_part}-testing-debug-{release}",
gpgurls,
enabled=False,
)
yield RpmRepository(
"epel-testing-source",
f"{url}&repo=testing-source-epel{release}",
f"{url}&repo=epel{repo_extra_part}-testing-source-{release}",
gpgurls,
enabled=False,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you double checked this also works with centos 9?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not think to test older versions, that is a good point. Is there and existing test suite I can just run to check this specific thing or should I write my own? Also if I have to write my own (I am assuming a handful of mkosi.conf files is enough) is there a good place to put that, so that future problems can be detected sooner?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integration test system is in dire need of a revamp, so a manual test will suffice for now.

@l-austenfeld l-austenfeld changed the title distribution: fix epel repo metalinks WIP: distribution: fix epel repo metalinks Jan 4, 2026
@l-austenfeld l-austenfeld changed the title WIP: distribution: fix epel repo metalinks distribution: fix epel repo metalinks Jan 16, 2026
@l-austenfeld
Copy link
Author

The GitHub diff is a bit confusing, so I will try to explain the changes:

I moved all existing metalink entries into an if that checks if the major release is below 10. I removed the two smaller checks for the same, both for epel-next, since they are now redundant.

I then added a separate else branch for release 10 and above that yields the new metalinks. I renamed the repo_extra_part variable to minor_version_flag to better reflect the meaning and used a small regex to detect if a minor version is present.

The minor version regex is the part I am most unsure about.
I could not find any existing minor version detection code in the project, so I had to write my own. I first thought about adding the functionality to GenericVersion. Seeing the different version formats that can handle, I decided that was above my skill level.
I decided that checking if the version string starts with a number followed by a period was enough to detect if a minor version is present.

daandemeyer added a commit to daandemeyer/mkosi that referenced this pull request Feb 12, 2026
Replaces systemd#4108

The previous PR didn't take into account that mirrors were changed
as well. This PR should cover all changes in RHEL 10 to how EPEL is
handled.
@l-austenfeld
Copy link
Author

Replaced by #4161

behrmann pushed a commit that referenced this pull request Feb 12, 2026
Replaces #4108

The previous PR didn't take into account that mirrors were changed
as well. This PR should cover all changes in RHEL 10 to how EPEL is
handled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants